//
//  MeTableViewCell.m
//  BGM
//
//  Created by liuqin on 2018/11/26.
//  Copyright © 2018年 com.alirtc.demo. All rights reserved.
//

#import "MeTableViewCell.h"
#import "Common.h"

@interface MeTableViewCell()





@end



@implementation MeTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self != nil) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
      
        
        self.iconBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 50, 50)];
        [self addSubview:self.iconBtn];
        
        self.contentLabel = [[UILabel alloc]initWithFrame:CGRectMake(60, 0, 300, 50)];
        self.contentLabel.textColor = bgmmainColor;
        self.contentLabel.font = [UIFont systemFontOfSize:18];
        [self addSubview:self.contentLabel];
        
        self.rightBtn = [[UIButton alloc]initWithFrame:CGRectMake(SCREENW-50, 0, 50, 50)];
        [self.rightBtn setImage:[UIImage imageNamed:@"gengduo"] forState:UIControlStateNormal];
        [self addSubview:self.rightBtn];
        
        
        
        self.rightImageBtn = [[UIButton alloc]initWithFrame:CGRectMake(SCREENW-80, 5, 40, 40)];
        [self.rightImageBtn setImage:[UIImage imageNamed:@"headImage"] forState:UIControlStateNormal];
        [self addSubview:self.rightImageBtn];
        self.rightImageBtn.layer.masksToBounds = YES;
        self.rightImageBtn.layer.cornerRadius = 20;
        self.rightImageBtn.hidden = YES;
        
        self.rightLabel = [[UILabel alloc]init];
        self.rightLabel.textAlignment = NSTextAlignmentRight;
        self.rightLabel.textColor = bgmgrayColor;
        [self addSubview:self.rightLabel];
        
        self.line = [[UILabel alloc]initWithFrame:CGRectMake(0, 50-0.3, SCREENW, 0.3)];
        self.line.backgroundColor = bgmColor(244, 244, 244);
        self.line.alpha = 0.4;
        [self addSubview:self.line];
        
        self.rightSwitch = [[UISwitch alloc]init];
        self.rightSwitch.onTintColor = bgmyelloeColor;
        [self addSubview:self.rightSwitch];
        self.rightSwitch.hidden = YES;
        
        [self.rightSwitch addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventValueChanged];   // 开关事件切换通知
        
      
    }
    return self;
}
- (void)switchAction:(id)sender{
    UISwitch *switchButton = (UISwitch*)sender;
    BOOL isButtonOn = [switchButton isOn];
    [self.meCellDelegate seleSwitch:isButtonOn];

}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
